package com.ruoyi.consume.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.consume.mapper.SeedApplyConMapper;
import com.ruoyi.consume.domain.SeedApplyCon;
import com.ruoyi.consume.service.ISeedApplyConService;

/**
 * 种子领用Service业务层处理
 *
 * @author ruoyi
 * @date 2021-07-22
 */
@Service
public class SeedApplyConServiceImpl implements ISeedApplyConService
{
    @Autowired
    private SeedApplyConMapper seedApplyConMapper;

    /**
     * 查询种子领用
     *
     * @param seedApplyId 种子领用ID
     * @return 种子领用
     */
    @Override
    public SeedApplyCon selectSeedApplyById(Long seedApplyId)
    {
        return seedApplyConMapper.selectSeedApplyById(seedApplyId);
    }

    /**
     * 查询种子领用列表
     *
     * @param seedApplyCon 种子领用
     * @return 种子领用
     */
    @Override
    public List<SeedApplyCon> selectSeedApplyList(SeedApplyCon seedApplyCon)
    {
        return seedApplyConMapper.selectSeedApplyList(seedApplyCon);
    }

    /**
     * 新增种子领用
     *
     * @param seedApplyCon 种子领用
     * @return 结果
     */
    @Override
    public int insertSeedApply(SeedApplyCon seedApplyCon)
    {
        seedApplyCon.setCreateTime(DateUtils.getNowDate());
        return seedApplyConMapper.insertSeedApply(seedApplyCon);
    }

    /**
     * 修改种子领用
     *
     * @param seedApplyCon 种子领用
     * @return 结果
     */
    @Override
    public int updateSeedApply(SeedApplyCon seedApplyCon)
    {
        seedApplyCon.setUpdateTime(DateUtils.getNowDate());
        return seedApplyConMapper.updateSeedApply(seedApplyCon);
    }

    /**
     * 批量删除种子领用
     *
     * @param seedApplyIds 需要删除的种子领用ID
     * @return 结果
     */
    @Override
    public int deleteSeedApplyByIds(Long[] seedApplyIds)
    {
        return seedApplyConMapper.deleteSeedApplyByIds(seedApplyIds);
    }

    /**
     * 删除种子领用信息
     *
     * @param seedApplyId 种子领用ID
     * @return 结果
     */
    @Override
    public int deleteSeedApplyById(Long seedApplyId)
    {
        return seedApplyConMapper.deleteSeedApplyById(seedApplyId);
    }

    /**
     * 更新库存量表
     *
     * @param seedApplyCon 种子领用ID
     * @return 结果
     */
    public int updateSeedAmount(SeedApplyCon seedApplyCon){
        return seedApplyConMapper.updateSeedAmount(seedApplyCon);
    }

    /**
     * 更新领用状态
     *
     * @param seedApplyId 种子领用ID
     * @return 结果
     */
    public int updateConsumeStatus(Long seedApplyId){
        return seedApplyConMapper.updateConsumeStatus(seedApplyId);
    }

    /**
     * 退回操作
     *
     * @param seedApplyId 种子领用ID
     * @return 结果
     */
    @Override
    public int updateApprovalStatus(Long seedApplyId){
        return seedApplyConMapper.updateApprovalStatus(seedApplyId);
    }
}
